﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;

namespace RoadTeam.Enums
{
    public class ConfigSection : ConfigurationSection
    {
        /// <summary>
        /// 数据库类型
        /// </summary>
        [ConfigurationProperty("DataDbType",DefaultValue="SQLServer")]
        public String DataDbType
        {
            get
            {
                if (base["DataDbType"] == null || String.IsNullOrEmpty(base["DataDbType"].ToString()))
                {
                    base["DataDbType"] = "SQLServer";
                }
                return base["DataDbType"].ToString();
            }
            set 
            {
                base["DataDbType"] = value;
            }
        }
        /// <summary>
        /// 数据库版本
        /// </summary>
        [ConfigurationProperty("DbVersion", DefaultValue = "SQL2008")]
        public String DbVersion
        {
            get
            {
                if (base["DbVersion"] == null || String.IsNullOrEmpty(base["DbVersion"].ToString()))
                {
                    base["DbVersion"] = "SQL2008";
                }
                return base["DbVersion"].ToString();
            }
            set
            {
                base["DbVersion"] = value;
            }
        }
        /// <summary>
        ///连接字符串
        /// </summary>
        [ConfigurationProperty("ConnectionString", DefaultValue ="")]
        public String ConnectionString
        {
            get
            {
                if (base["ConnectionString"] == null || String.IsNullOrEmpty(base["ConnectionString"].ToString()))
                {
                    base["ConnectionString"] = String.Empty;
                }
                return base["ConnectionString"].ToString();
            }
            set
            {
                base["ConnectionString"] = value;
            }
        }

        /// <summary>
        ///文件存储路径
        /// </summary>
        [ConfigurationProperty("FilePath", DefaultValue = "")]
        public String FilePath
        {
            get
            {
                if (base["FilePath"] == null || String.IsNullOrEmpty(base["FilePath"].ToString()))
                {
                    base["FilePath"] = String.Empty;
                }
                return base["FilePath"].ToString();
            }
            set
            {
                base["FilePath"] = value;
            }
        }



    }

    public class RoadTeamSystemConfigSection : ConfigurationSection
    {
        /// <summary>
        /// 数据库类型
        /// 对接乐天系统的数据库类型
        /// </summary>
        [ConfigurationProperty("DataDbType", DefaultValue = "SQLServer")]
        public String DataDbType
        {
            get
            {
                if (base["DataDbType"] == null || String.IsNullOrEmpty(base["DataDbType"].ToString()))
                {
                    base["DataDbType"] = "SQLServer";
                }
                return base["DataDbType"].ToString();
            }
            set
            {
                base["DataDbType"] = value;
            }
        }
        /// <summary>
        /// 数据库版本
        /// 对接乐天系统的数据库版本
        /// </summary>
        [ConfigurationProperty("DbVersion", DefaultValue = "SQL2008")]
        public String DbVersion
        {
            get
            {
                if (base["DbVersion"] == null || String.IsNullOrEmpty(base["DbVersion"].ToString()))
                {
                    base["DbVersion"] = "SQL2008";
                }
                return base["DbVersion"].ToString();
            }
            set
            {
                base["DbVersion"] = value;
            }
        }
        /// <summary>
        ///连接字符串
        ///对接乐天系统的数据库连接字符串
        /// </summary>
        [ConfigurationProperty("ConnectionString", DefaultValue = "")]
        public String ConnectionString
        {
            get
            {
                if (base["ConnectionString"] == null || String.IsNullOrEmpty(base["ConnectionString"].ToString()))
                {
                    base["ConnectionString"] = String.Empty;
                }
                return base["ConnectionString"].ToString();
            }
            set
            {
                base["ConnectionString"] = value;
            }
        }

        /// <summary>
        /// 乐天系统类型
        /// 对接乐天系统的数据库连接字符串
        /// </summary>
        [ConfigurationProperty("SystemType", DefaultValue = "CS")]
        public String SystemType
        {
            get
            {
                if (base["SystemType"] == null || String.IsNullOrEmpty(base["SystemType"].ToString()))
                {
                    base["SystemType"] = String.Empty;
                }
                return base["SystemType"].ToString();
            }
            set
            {
                base["SystemType"] = value;
            }
        }

        /// <summary>
        /// 乐天系统类型
        /// 对接乐天系统的数据库连接字符串
        /// </summary>
        [ConfigurationProperty("Path", DefaultValue = "RoadTeam.CsSystem")]
        public String SystemPath
        {
            get
            {
                if (base["Path"] == null || String.IsNullOrEmpty(base["Path"].ToString()))
                {
                    base["Path"] = String.Empty;
                }
                return base["Path"].ToString();
            }
            set
            {
                base["Path"] = value;
            }
        }



    }
}
